<#assign contextPath=springMacroRequestContext.getContextPath()/>
<#import "/public/frame/main.html" as frame/>
<@frame.head "南航明珠商城-添加商品"></@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css"/>
<div class="page-container">
	<form method="post" name="query_product_list_form" id="query_product_list_form" action="${contextPath}/presentActivityController/to_add_product">    
		<input type="hidden" name="page" value="${pagination.pageNo}" id="page"/>
		<input type="hidden" name="pWindowName" value="${pWindowName}" id="pWindowName"/> <!-- 调用端窗口的windowname，用于处理返回值时获取调用端的ifreame对象 -->
		<#list excludeIds as id>
		<input type="hidden" name="excludeIds" value="${id}"/>
		</#list>
		<input type="hidden" name="productIds" id="productIds" value="${productIds}"/> <!-- 被选中的产品ID -->
		<div class="text-c">
			<table class="table search_table">
				<tr>   
					<td>商品编号：</td>
					<td><input type="text" class="input-text radius" placeholder="商品编号" id="prodId" name="prodId" value="${(productQo.prodId?c)!}"/></td>
					<td>商品名称：</td>
					<td><input type="text" class="input-text radius" placeholder="商品名称" id="proName" name="proName" value="${productQo.proName}"/></td>     
					<td>供应商：</td>
					<td>
						<span class="select-box radius">
							<select class="select" id="merchantQoId" name="merchantQo.id" >
								<option value>请选择</option>
							  	<#list merchantNewList as list>  
							    <option value="${list.id?c}" <#if list.id==productQo.merchantQo.id>selected="selected"</#if>>${list.mercName}</option>
							  	</#list>
							</select>
						</span>
					</td>  
				</tr>
				<tr>
					<td>商品分类：</td>
	           		<td>
	             		<span class="select-box radius">
		               		<select class="select" id="proType" name="proType" >   
		                 		<option value>请选择</option>
		                 		<#list prodTypeList as list>  
		                 		<option value="${list.id?c}" <#if list.id==productQo.proType>selected="selected"</#if>>${list.name}</option>
		                 		</#list>
		               		</select>
	             		</span>  
					</td>  
	           		<td>商品品牌：</td>
	           		<td>
	             		<span class="select-box radius">
	               			<select class="select" id="brandId" name="brandId" >
	                			<option value>请选择</option>
	                 			<#list brandList as list>  
	                 			<option value="${list.id?c}" <#if list.id==productQo.brandId>selected="selected"</#if>>${list.name}</option>
	                 			</#list>               
	               			</select>
	             		</span>  
	           		</td> 
	           		<td></td>
	           		<td>
	           			<input class="btn btn-success radius" type="button" onclick="search();" value="搜索"/>
	           			<input class="btn btn-success radius" type="button" onclick="toIsEmpty();" value="重置"/>
	             	</td> 
	         	</tr>  
			</table>
		</div>
	</form>
    <div class="cl pd-5 bg-1 bk-gray mt-20 radius"> 
	    <span class="l">  
	    	<a href="javascript:;" onclick="addProduct();" class="btn btn-primary radius">确定添加选中商品</a> 
	    </span>
    	<span class="r">共有数据：<strong>${pagination.totalCount}</strong>条</span>
    </div>
    <table class="table table-border table-bordered table-bg radius table-hover" style="margin-top: -1px;">
		<thead>
			<tr class="text-c">
	      		<th style="width: 5%;">
	            	<input type="checkbox" id="chkAll" onclick="selectAll();" style="cursor: pointer;"/>
	            </th>
	            <th style="width: 8%;">商品编号</th>
	            <th style="width: 20%;">商品名称</th>
	            <th style="width: 20%;">商品类别</th>
	            <th style="width: 20%;">供应商</th>
				<th style="width: 12%;">商品品牌</th>
	            <th style="width: 5%;">库存</th>
	            <th style="width: 10%;">商品价格</th>
	        </tr>
        </thead>
        <tbody>
       		<#if pagination.list?? && (pagination.list?size &gt; 0) >
	        	<#list pagination.list as product> 
	            <tr class="text-c">
	                <td><input type="checkbox" id="chk_${product.id?c}" name="chk" onclick="ckClicked(this);" value="${product.id?c}" style="cursor: pointer;"/></td>
	                <td id="id_${product.id?c}">${product.id?c}</td>
	                <td id="name_${product.id?c}">${product.baseInfo.name}</td>
	                <td id="prodType_${product.id?c}">
		                ${product.productProperty.prodTypeOne.name}&lt;
		                ${product.productProperty.prodTypeTwo.name}&lt;
		                ${product.productProperty.prodTypeThree.name}
	                </td>
	                <td id="mercName_${product.id?c}">${product.merchant.mercName}</td>
	                <td id="brand_${product.id?c}">${brandMap['${product.brandId}']}</td>
	                <td id="storeNum_${product.id?c}">${product.storeInfo.storeNum}</td>
	                <td id="payOneMileage_${product.id?c}">${product.priceInfo.payOneMileage}公里</td>
	                <td id="payCostMileage_${product.id?c}" style="display: none;"><#if product.priceInfo.payCostMileage?? && product.priceInfo.payCostMileage != "">${product.priceInfo.payCostMileage + "公里"}</#if></td><!-- 商品原价 -->
	        	</tr>
	      		</#list>
      		</#if>
		</tbody>
	</table>
	<div id="div_page" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default"></@frame.end>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/presentActivity/product_list.js"></script>
<script type="text/javascript">
	var path = "${contextPath}";
	laypage({
	    cont: "div_page", // 容器。值支持id名、原生dom对象，jquery对象。
	    pages: ${pagination.totalPage}, // 通过后台拿到的总页数
	    curr:  ${pagination.pageNo} || 1, // 当前页
		skip: true, // 是否开启跳页
		first: 1, // 将首页显示为数字1,。若不显示，设置false即可
		last: ${pagination.totalPage}, // 将尾页显示为总页数。若不显示，设置false即可
	    jump: function(obj, first){ // 触发分页后的回调
	        if(!first){ // 点击跳页触发函数;当前页为obj.curr
	        	setSelectedId();
	            $("#page").val(obj.curr);
	            $("#query_product_list_form").submit();
	        }
	    }
	});
</script>